import { _decorator, Button, Component, Scene } from "cc";
import BaseView from "../../../framework/ui/BaseView";
import { bindNode } from "../../../framework/ui/UIDecorator";
import { SceneMgr } from "../../../framework/scene/SceneMgr";
import UIMgr from "../../../framework/ui/UIMgr";
import { SceneDefine, ViewDefine } from "../../Defines";



const { ccclass } = _decorator;

@ccclass("HomeView")
export class HomeView extends BaseView{

    @bindNode("Battle",Button)
    battleBtn:Button;

    protected init(): void {
        this.useAnimation = false
    }
    
    protected show(...args: any[]): void {
        this.battleBtn.node.on(Button.EventType.CLICK,()=>{
            SceneMgr.ins.enterScene(SceneDefine.Battle,()=>{
                UIMgr.ins.showUI(ViewDefine.BattleView)
            })
        },this)
    }

    protected close(): void {
        this.battleBtn.node.off(Button.EventType.CLICK)
    }

}